#include <stdio.h>
#include <unistd.h>

int main()
{
    FILE *fp = fopen("myfile", "w");
    if(!fp){
        printf("fopen error!\n");
    }
    while(1)
    {
        sleep(1);
        printf("进程pid:%d\n",getpid());
    }
    fclose(fp);
    return 0;
}
